<include file="theme/functions"/>
<include file="public@header"/>
</head>
<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--页面主要内容-->
        <main class="lyear-layout-content">
          
            <div class="container-fluid">
            
                <div class="row">
                   <div class="col-md-12">
                        <div class="card">
                            <ul class="nav nav-tabs">
                                <li>
                                    <a href="{:url('theme/fileSetting',['file_id'=>$file_id,'tab'=>'widget'])}">
                                        组件
                                    </a>
                                </li>
                                <notempty name="file.more.vars">
                                    <li>
                                        <a href="{:url('theme/fileSetting',['file_id'=>$file_id,'tab'=>'var'])}">
                                            设置
                                        </a>
                                    </li>
                                </notempty>
                                <notempty name="has_public_var">
                                    <li class="active">
                                        <a href="{:url('theme/fileSetting',['file_id'=>$file_id,'tab'=>'public_var'])}">
                                            全局设置
                                        </a>
                                    </li>
                                </notempty>
                            </ul>
                            <div class="card-body">
                                <form method="post" class="js-ajax-form  margin-top-20" action="{:url('theme/settingPost')}">
                                    <foreach name="files" item="file">
                                        <if condition="$file.id neq $file_id">
                                            <notempty name="file['more']['vars']">
                                                {:_parse_vars($file.more.vars,'files['.$file['id'].'][vars]',1,'',$file['id'])}
                                                <else/>
                                            </notempty>
                                        </if>
                                    </foreach>
                                    <div class="form-group text-center" style="display: none;">
                                        <!--<input type="hidden" name="id" value="{$file.id}">-->
                                        <button type="submit" class="btn btn-primary js-ajax-submit" id="submit-btn" data-success="successCallback">
                                            {:lang('SAVE')}
                                        </button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>
    </div>
</div>
<include file="theme/scripts"/>
<script>
    function successCallback(data, statusText, xhr, $form) {
        function _refresh() {
            if (data.url) {
                //返回带跳转地址
                window.location.href = data.url;
            } else {
                if (data.code == 1) {
                    //刷新当前页
                    reloadPage(window);
                }
            }
        }
        lightyear.notify(data.msg, 'success');
        setTimeout(function() {
        if (parent.afterSaveSetting) {
                    parent.afterSaveSetting();
                }
            _refresh();
        }, 1e3)
        // noty({
        //     text: data.msg,
        //     type: 'success',
        //     layout: 'topCenter',
        //     modal: true,
        //     // animation: {
        //     //     open: 'animated bounceInDown', // Animate.css class names
        //     //     close: 'animated bounceOutUp', // Animate.css class names
        //     // },
        //     timeout: 800,
        //     callback: {
        //         afterClose: function () {
        //             if (parent.afterSaveSetting) {
        //                 parent.afterSaveSetting();
        //             }
        //             _refresh();
        //         }
        //     }
        // });
    }
</script>
</body>
</html>